{% extends 'df_goods/base.html' %}
{% block detail %}
{#    搜索的关键字是：{{ query }}、{{ paginator }}、{{ page_obj }}、{{ is_paginated }}、{{ object_list }}<br>#}
{#    当前页的Page对象：{{ page_obj.object }}<br>#}
    <h3>搜索结果如下：</h3>
    搜索的关键字是：{{ query }}
    <ul class="goods_type_list clearfix">
        {% for foo in object_list %}
            <li>
                <a href="/{{ foo.object.id }}"><img src="/media/{{ foo.object.gpic }}"></a>
                <h4><a href="/{{ foo.object.id }}">{{ foo.object.gtitle }}</a></h4>
                <div class="operate">
                    <span class="prize">￥{{ foo.object.gprice }}</span>
                    <span class="unit">{{ foo.object.gunit }}</span>
                    <a href="{% url 'cart:add' foo.object.id 1 %}" class="add_goods" title="加入购物车"></a>
                </div>
            </li>
        {% endfor %}
    </ul>
    {% if page_obj.has_previous or page_obj.has_next %}
        <div>
            {% if page_obj.has_previous %}
                <a href="/search?q={{ query }}&amp;page={{ page_obj.previous_page_number }}">{% endif %}&laquo;
            上一页{% if page_obj.has_previous %}</a>{% endif %}
            |
            {% if page_obj.has_next %}<a href="/search?q={{ query }}&amp;page={{ page_obj.next_page_number }}">{% endif %}下一页 &raquo;
            {% if page_obj.has_next %}</a>{% endif %}
        </div>
    {% endif %}
{% endblock %}
